// Tags: DP, List, Multiply
#include <algorithm>
#include <cstdio>

typedef unsigned long long ull;
const int N = 1e5 + 5, bit = 17;
int n, m, pos[N], pre[N], nxt[N], ta[N], tb[N], f[2][bit][N];
ull da[2][bit][N], db[2][bit][N];

struct Node {
  int id, x;
  inline bool operator<(const Node &rhs) const { return x < rhs.x; }
} a[N];

inline int choose(int x, int l, int r) {
  if (!l) return r;
  if (!r) return l;
  return a[r].x - a[x].x < a[x].x - a[l].x ? r : l;
}

inline std::pair<ull, ull> calc(int i, ull x) {
  int p = i;
  ull disa = 0, disb = 0;
  for (int j = bit - 1; ~j; --j) {
    if (f[0][j][p] && disa + disb + da[0][j][p] + db[0][j][p] <= x) {
      disa += da[0][j][p], disb += db[0][j][p];
      p = f[0][j][p];
    }
  }
  return std::make_pair(disa, disb);
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("P1081 开车旅行.in", "r", stdin);
  freopen("P1081 开车旅行.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) { scanf("%d", &a[i].x), a[i].id = i; }
  std::sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) {
    pos[a[i].id] = i;
    pre[i] = i - 1, nxt[i] = i + 1;
  }
  nxt[n] = 0;
  for (int i = 1, cur; i <= n; ++i) {
    cur = pos[i];
    tb[i] = a[choose(cur, pre[cur], nxt[cur])].id;
    if (tb[i] == a[pre[cur]].id) {
      ta[i] = a[choose(cur, pre[pre[cur]], nxt[cur])].id;
    } else {
      ta[i] = a[choose(cur, pre[cur], nxt[nxt[cur]])].id;
    }
    if (pre[cur]) nxt[pre[cur]] = nxt[cur];
    if (nxt[cur]) pre[nxt[cur]] = pre[cur];
  }
  for (int i = 1; i <= n; ++i) {
    f[0][0][i] = ta[i], f[1][0][i] = tb[i];
    da[0][0][i] = std::abs(a[pos[i]].x - a[pos[ta[i]]].x);
    db[1][0][i] = std::abs(a[pos[i]].x - a[pos[tb[i]]].x);
  }
  for (int i = 1; i <= n; ++i) {
    f[0][1][i] = f[1][0][f[0][0][i]];
    f[1][1][i] = f[0][0][f[1][0][i]];
    da[0][1][i] = da[0][0][i] + da[1][0][f[0][0][i]];
    da[1][1][i] = da[1][0][i] + da[0][0][f[1][0][i]];
    db[0][1][i] = db[0][0][i] + db[1][0][f[0][0][i]];
    db[1][1][i] = db[1][0][i] + db[0][0][f[1][0][i]];
  }
  for (int i = 2; i < bit; ++i) {
    for (int j = 1; j <= n; ++j) {
      f[0][i][j] = f[0][i - 1][f[0][i - 1][j]];
      f[1][i][j] = f[1][i - 1][f[1][i - 1][j]];
      da[0][i][j] = da[0][i - 1][j] + da[0][i - 1][f[0][i - 1][j]];
      da[1][i][j] = da[1][i - 1][j] + da[1][i - 1][f[1][i - 1][j]];
      db[0][i][j] = db[0][i - 1][j] + db[0][i - 1][f[0][i - 1][j]];
      db[1][i][j] = db[1][i - 1][j] + db[1][i - 1][f[1][i - 1][j]];
    }
  }
  int ans = 0, x;
  scanf("%d%d", &x, &m);
  long double minn = 1e18;
  for (int i = 1; i <= n; ++i) {
    std::pair<ull, ull> tmp = calc(i, x);
    if (tmp.second && 1.0 * tmp.first / tmp.second < minn) {
      minn = 1.0 * tmp.first / tmp.second;
      ans = i;
    }
  }
  printf("%d\n", ans);
  for (int i = 1, s; i <= m; ++i) {
    scanf("%d%d", &s, &x);
    std::pair<ull, ull> tmp = calc(s, x);
    printf("%llu %llu\n", tmp.first, tmp.second);
  }
  return 0;
}